﻿#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

typedef double Real;
typedef int MyInt;

Real f(Real x)
{
	if (x == 10)
		return 1 / x;
	return x;
}

typedef struct TContext_s
{
	MyInt n;
}TContext;

TContext context;

void read_data(TContext* ctx)
{
	scanf("%d", &ctx->n);
}

int prime(int p)
{
	if (p < 2)
		return 0;
	else if (p < 4)
		return 1;
	else if (p % 2 == 0)
		return 0;
	int p2 = (int)sqrt(p) + 1;
	for (int i = 3; i <= p2; i += 2)
		if (p % i == 0)
			return 0;
	return 1;
}

void do_task(TContext* ctx)
{
	int n = 0;
	for (int i = 5; i <= ctx->n; ++i)
		if (prime(i-2) && prime(i))
		{
			printf("%d ", i);
			n++;
		}
	printf("\n");
	printf("%d\n", n);
}

void solve(TContext* ctx)
{
	read_data(ctx);
	do_task(ctx);
}

int main()
{
	freopen("D:/Develop/GitRepos/MOOC/浙江大学/数据结构/201906/DataStructure/M2019秋C入门和进阶练习集/7-143.txt", "r", stdin);
	solve(&context);
	return 0;
}
